<%@page import="DAL.*" errorPage="_Error.jsp"%>
<%@page import="java.util.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="/SPORT/Style/MsgStyle.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/SPORT/Script/jquery-1.10.1.js"></script>
<title>Insert title here</title>
<script>
	$(function()
	{		
		$(".btnPrint").click(function()
		{
			window.print();
		});
	});
</script>
</head>
<body>
<div class="div_container">
	<div class="searchDiv">
		<form action="/SPORT/ScoreHandle" method="get">
			<span>查询条件：</span>
			<select name="condition">
				<option value='MathName'>项目名称</option>
				<option value='MathId'>项目编号</option>
				<option value='PName'>院名</option>
			</select>
			
			<select name="rankby">
				<option value='time'>按时间排名</option>
				<option value='distance'>按距离排名</option>
			</select>
				 	
			<span>查询值：</span>
			<input type="hidden" name="type" value="6" />
			<input type="text" name="value" />
			<input type="submit" value="查询 "/>
			<input type="button" value="打印" class="btnPrint"/>
		</form>
	</div>
	<!-- searchDiv End -->

	<table id="print">
		<thead>
			<tr>
				<th>比赛排名</th>
				<th>项目名称</th>
				<th>运动员姓名</th>
				<th>所在学院</th>
				<th>比赛成绩</th>
				<th>比赛得分</th>
			</tr>
		</thead>

		<tbody>
			<% 
	                	response.setCharacterEncoding("UTF-8");//设置输出数据的编码格式
				request.setCharacterEncoding("UTF-8");//设置获取数据的编码格式
				List<Object> list=(List<Object>)request.getAttribute("list");//获取servlet端转发的list数据列表
                		if(list!=null) //循环数据列表，生成表格行
                		{
                			for(int i=0;i<list.size();i++)
	                		{
	               				Object[] obj;
	               				obj=(Object[])list.get(i);
	               				String tag=obj[5].toString().equals("0")?" 秒":" 米";
	               				out.print("<tr><td>"+obj[0]+"</td><td>"+obj[1]+"</td><td>"+obj[2]+"</td><td>"+obj[3]+"</td><td>"+obj[4]+tag+"</td><td>"+obj[6]+"</td></tr>");
	                		}
                		}

	                %>
		</tbody>

	</table>
</div>
</body>
</html>
